package com.kitty.game.confirm.service.handler;

import com.kitty.game.confirm.model.BuyZMLConfirm;
import com.kitty.game.role.model.Role;
import com.kitty.game.team.message.ReqConfirmResult;
import com.kitty.game.zhenmolu.service.ZhenMoLuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BuyZMLConfirmHandler extends ConfirmHandler {
   @Autowired
   ZhenMoLuService zhenMoLuService;

   public void handleConfirmResult(Role role, ReqConfirmResult reqConfirmResult) {
      if ("1".equals(reqConfirmResult.getSelect())) {
         this.buyZhenmoling(role);
      }

   }

   private void buyZhenmoling(Role role) {
      BuyZMLConfirm confirm = (BuyZMLConfirm)role.getConfirm();
      int count = confirm.getCount();
      this.zhenMoLuService.buyZML(role, count);
   }
}
